package com.example.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class helloJava {
    @Value("${country}")
    private String country1;
    @Value("${province}")
    private String country2;
    @Value("${a.b.c.d.e}")
    private String country3;
//    @Value("${user2[1]}")
//    private String country4;
//    @Autowired   //封装所有配置信息
// private Environment env;
    @Autowired
    private MyDataSource myDataSource;

    @GetMapping("/hello")
    public String hello(){
        System.out.println(country1+country2+country3);
        System.out.println("----------");
//        System.out.println(env.getProperty("city")); //getProperty()
        System.out.println("-----------");
        System.out.println(myDataSource);
        return "hi";
    }
}
